package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * 维修过程表
 */
@Entity
@Table(name = "course", schema = "springboot", catalog = "")
public class Course {
    private int courId;                 //维修过程id
    private String courRemark;          //维修备注
    private Timestamp courDate;         //预计完成日期
    private String courCrew;            //维修人员
    private Timestamp courDates;        //维修开始日期
    private Timestamp courData;         //维修完成日期
    private String courState;           //当前状态
    private Maintain maintainByTainId;

    public Course() {

    }

    @Id
    @Column(name = "cour_id")
    public int getCourId() {
        return courId;
    }

    public void setCourId(int courId) {
        this.courId = courId;
    }

    @Basic
    @Column(name = "cour_remark")
    public String getCourRemark() {
        return courRemark;
    }

    public void setCourRemark(String courRemark) {
        this.courRemark = courRemark;
    }

    @Basic
    @Column(name = "cour_date")
    public Timestamp getCourDate() {
        return courDate;
    }

    public void setCourDate(Timestamp courDate) {
        this.courDate = courDate;
    }

    @Basic
    @Column(name = "cour_crew")
    public String getCourCrew() {
        return courCrew;
    }

    public void setCourCrew(String courCrew) {
        this.courCrew = courCrew;
    }

    @Basic
    @Column(name = "cour_dates")
    public Timestamp getCourDates() {
        return courDates;
    }

    public void setCourDates(Timestamp courDates) {
        this.courDates = courDates;
    }

    @Basic
    @Column(name = "cour_data")
    public Timestamp getCourData() {
        return courData;
    }

    public void setCourData(Timestamp courData) {
        this.courData = courData;
    }

    @Basic
    @Column(name = "cour_state")
    public String getCourState() {
        return courState;
    }

    public void setCourState(String courState) {
        this.courState = courState;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Course course = (Course) o;
        return courId == course.courId &&
                Objects.equals(courRemark, course.courRemark) &&
                Objects.equals(courDate, course.courDate) &&
                Objects.equals(courCrew, course.courCrew) &&
                Objects.equals(courDates, course.courDates) &&
                Objects.equals(courData, course.courData) &&
                Objects.equals(courState, course.courState);
    }

    @Override
    public int hashCode() {
        return Objects.hash(courId, courRemark, courDate, courCrew, courDates, courData, courState);
    }

    @ManyToOne
    @JoinColumn(name = "tain_id", referencedColumnName = "tain_id")
    public Maintain getMaintainByTainId() {
        return maintainByTainId;
    }

    public void setMaintainByTainId(Maintain maintainByTainId) {
        this.maintainByTainId = maintainByTainId;
    }
}
